package com.imay.live.logic;

import com.imay.live.utils.TimeUtil;

import java.util.Date;


/**
 * Created by  nick on 2017/5/12 0012.
 * 私信时间显示逻辑
 */

public class ChatTimeLogic {

    /**
     * @param time
     * @return
     */
    public static String getMessageTime(long time) {
        if (TimeUtil.isToday(time)) {
            return TimeUtil.getTodayTime(time);
        } else if (TimeUtil.isThisWeek(time)) {
            return TimeUtil.getWeekOfDate(time);
        } else {
            return TimeUtil.getFormatTime(time);
        }
    }

    /**是否是两分钟内
     * @return
     */
    public static boolean isBettewTowMinute(long time1,long time2) {
        long diff = Math.abs((time1 - time2) * 1000);
        long r = 0;
        if (diff > TimeUtil.MINUTE) {
            r = (diff /TimeUtil.MINUTE);
            return r<=2 ;
        }
        return true;
    }


}
